﻿//* Copyright(C) 2005-2012, all rights reserved.
//*
//* The following code is copyrighted and contains proprietary information
/* and trade secrets of Foxit Software Inc.      
**************************************************************************
*/

/**
* 文档信息插件类；
*/



define(function (require, exports, module) {


    FXREADER.CDocPropertiesPlugin = function (pReaderApp) {
              _pReaderApp = pReaderApp;
              _bDlgInited = false;
              _PopupDlg = null;
              _Language = _pReaderApp.GetLanguage();
              var _self = this;

        //获取Plugin名称;
        this.GetPluginName = function () {
            return "OffLine Plugin";
        };
        //插件被注册的时候调用;
        this.PIOnRegister = function () {
           
        };
        //模块初始化;
        this.PIInit = function () {
            _self.CreateCmdAndBtn();
            _pReaderApp.StepProgress();
        };
        //模块卸载;
        this.PIUnload = function () {
        };

        this.GetReaderApp = function () {
            return _pReaderApp;
        };
        this.CreateCmdAndBtn = function () {
        	//创建按钮
            _pReaderApp.AddCommandUI({
                UIName: "OffLineReader",
                CommandName: 'OffLineReader',
                State: false,
                CreateHtmlContentFunc: function () {
                	
                	//"<a class='fwr_toobar_image_btn fwr_toobar_download_nor fwr_toolbar_btn'  target='_blank' href='DownLoad.do?fileId="+jQuery('#fileid').val()+"' id='offlineButs'  title='" + _Language.OffLineReader.Title + "' style='margin-right:2px;' cmd='" + "OffLineReader" + "'></a>";
                	return "<a class='fwr_toobar_download_dis fwr_toobar_image_btn'  target='_blank'  id='offlineButs'  title='" + _Language.OffLineReader.Title + "' style='margin-right:2px;' cmd='" + "OffLineReader" + "'></a>";
                },
                Init:function(){
                	var offLine=jQuery("#offLinestate").val();
                	if(offLine=='true'){
                        FXREADER.Common.UpdateBtnState('offlineButs', "fwr_toobar_download_nor", "fwr_toobar_download_dis", true);
                        $("#offlineButs").bind('click', function () {
                            if ($("#offlineButs").hasClass("fwr_toobar_download_nor"))
                                window.location.href="DownLoad.do?fileId="+jQuery('#fileid').val();
                            return false;
                        });
                	}
                }
            });
        };
    };

    exports.Reader_CreatePlugin = function (pReaderApp) {
        var pDocPropertiesPlugin = new FXREADER.CDocPropertiesPlugin(pReaderApp);
        return pDocPropertiesPlugin;
    };
});